package bargain.server.service.impl;

import bargain.server.service.TransferService;
import bargain.service.AService;
import bargain.util.IdWorker;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * @ClassName TransferServiceImpl
 * @Description
 * @Author Jingxiao.Ye
 * @Date 2022/1/4 下午11:10
 * @Version V1.0
 * @Since JDK 11
 */
@Service
@DubboService
public class TransferServiceImpl implements TransferService {

    @DubboReference
    private AService aService;

    @Override
    public void transfer(long accountIdA, long accountIdB, BigDecimal rmb, BigDecimal dollar) {
        IdWorker idWorker = new IdWorker(1, 1, 1);
        long l = idWorker.nextId();
        aService.transferAccount(l,accountIdA,accountIdB,dollar,rmb);
    }

}
